import { ModuleC, ModuleS, SoundManager } from "odin";
import { Consts } from "../../Consts";

export class ModuleS_Sound extends ModuleS<ModuleC_Sound,null>
{

    /**
	 * 播放开枪音效
	 * @param loc 枪口位置
	 */
	public shootSound(loc:Type.Vector):void
	{
		SoundManager.instance.play3DSound(Consts.Sound.Shoot,loc,1);
	}

    /**
	 * 播放击中音效
	 * @param pos 击中位置
	 */
    public hitSound(pos:Type.Vector):void
    {
        SoundManager.instance.play3DSound(Consts.Sound.Hit,pos,1);
    }

    /**
     * 角色被击中时音效
     * @param chara 被击中角色
     */
    public hitPlayerSound(chara:GamePlay.Player|GamePlay.Humanoid):void
    {
        SoundManager.instance.play3DSound(Consts.Sound.hitCharacther,chara.location,1);
    }

}

export class ModuleC_Sound extends ModuleC<ModuleS_Sound,null>
{
    /**
     * 播放开始界面BGM
     */
    public playStartBGM():void
    {
        SoundManager.instance.playBGM(Consts.BGM.Start,0.5);
    }

    /**
     * 播放游戏时BGM
     */
    public playGameBGM():void
    {
        SoundManager.instance.playBGM(Consts.BGM.Game,0.5);
    }

    /**
     * 播放结算界面BGM
     */
    public playOverBGM():void
    {
        SoundManager.instance.playBGM(Consts.BGM.Over,1);
    }

    /**
     * 关闭BGM
     */
    public closeBGM():void
    {
        SoundManager.instance.stopBGM();
    }

    /**
     * 按钮音效
     */
    public ButtonSound():void
    {
        SoundManager.instance.playSound(Consts.Sound.Button,1,1);
    }
}